package com.minelx.statementsplus.cha.base;

import com.minelx.landisk.filesystem.core.File;
import com.minelx.statementsplus.cha.base.response.ExplainResponse;

import javax.sql.DataSource;

public class TunnelChaSession implements ChaSession {
	private final DataSource dataSource;

	public TunnelChaSession(DataSource dataSource) {
		this.dataSource = dataSource;
	}

	@Override
	public void download(TaskCommitment taskCommitment, File file) {
		ResponseFetcher fetcher = new TunnelResponseFetcher(dataSource, taskCommitment);
		new WorkingFileTaskRunner(fetcher, file).run();
	}

	@Override
	public ExplainResponse explainForResponse(String majorSql) {
		System.err.println("TunnelChaSession.explainForResponse() is not implemented, returns true as default.");
		System.err.println("TunnelChaSession.explainForResponse() is not implemented, returns true as default.");
		System.err.println("TunnelChaSession.explainForResponse() is not implemented, returns true as default.");
		return new ExplainResponse(true, "TunnelChaSession returns true as default.");
	}
}
